package com.aispeech.asr.comm.exceptions;

import com.aispeech.asr.comm.data.vo.sentence.AsrData;
import com.aispeech.asr.comm.enums.APICode;
import com.aispeech.asr.comm.enums.ErrorCode;
import com.aispeech.asr.comm.data.vo.sentence.AsrData;

public class AsrException extends Exception {
    private int code;
    private AsrData data;

    public AsrException(int errcode, String message) {
        super(message);
        this.code = errcode;
    }

    public AsrException(APICode code) {
        super(code.getMessage());
        this.code = code.getCode();
    }

    public AsrException(ErrorCode code) {
        super(code.error);
        this.code = code.errid;
    }

    public AsrException(String message) {
        super(message);
        code = APICode.INTERNAL_ERROR.getCode();
    }

    public int getCode() {
        return code;
    }

    public void setData(AsrData data) {
        this.data = data;
    }

    public AsrData getData() {
        return data;
    }
}
